package offer.algorithm;

import java.util.StringTokenizer;

/**
 * Description：
 * Author: zhangc
 * Date：2017/7/27 16:47
 */
public class ResverseSequence42 {

    public static String reverseSequence(String str) {

        String temp = reverseStr(str);
        StringTokenizer stringTokenizer = new StringTokenizer(temp);
        StringBuilder builder = new StringBuilder();
        while (stringTokenizer.hasMoreTokens())
            builder.append(reverseStr(stringTokenizer.nextToken())+' ');
        if (builder.length()>1)
            builder = builder.deleteCharAt(builder.length()-1);
        return builder.toString();
    }


    private static String reverseStr(String str) {
        StringBuilder sb = new StringBuilder();
        sb.append(str);
        return sb.reverse().toString();

    }
    

}
